import request from '@/modules/index/utils/request';
import qs from "qs";

const store = {
    state: {

    },
    mutations: {

    },
    actions: {
        /**
         * 原始文件输入接口
         * */
        async feDatafileUploadAnalyze(context, params) {
            const data = await request({
                url: 'feDatafile/pageList',
                method: 'post',
                data: params
            });
            return data;
        },
        // 列表
        async feDatafile(context,params) {
            const data = await request({
                url: params ? `feDatafile/list?${params}` : 'feCanvas/list',
                method: 'get'
            });
            return data;
        },
        // 列表By Id
        async feDatafileGetById(context, params) {
            const data = await request({
                url: `feDatafile/getById?${params}`,
                method: 'get'
            });
            return data;
        },
        // 分页列表
        async feDatafilePageList(context, params) {
            const data = await request({
                url: params ? `feCanvas/pageList?${params}` : 'feCanvas/pageList',
                method: 'get'
            });
            return data;
        },
        // 新增
        async feDatafileSave(context, params) {
            const data = await request({
                url: 'feCanvas/save',
                method: 'post',
                data: params
            });
            return data;
        },
        // 修改或新增
        async feDatafileSaveOrUpdate(context, params) {
            const data = await request({
                url: 'feCanvas/saveOrUpdate',
                method: 'post',
                data: params
            });
            return data;
        },
        async feDatafileSaveOrUpdateBatch(context, params) {
            const data = await request({
                url: 'feCanvas/saveOrUpdateBatch',
                method: 'post',
                data: params
            });
            return data;
        },
        // 删除
        async feDatafieldBatchDelete(context, params) {
            const data = await request({
                url: 'feCanvas/deleteByIds',
                method: 'post',
                params: params,
                paramsSerializer: (params) => {
                    return qs.stringify(params, {indices: false});
                },
            });
            return data;
        },

    }
};

export default store;
